Skip to content

Conversation

@RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Nov 26, 2025

@TomWoodward TomWoodward temporarily deployed to rex-web-core-1389-toc-b-fc5zkh November 26, 2025 16:22 Inactive
@RoyEJohnson RoyEJohnson marked this pull request as ready for review December 1, 2025 20:08
@RoyEJohnson RoyEJohnson requested a review from a team as a code owner December 1, 2025 20:08
@RoyEJohnson RoyEJohnson requested a review from Dantemss December 1, 2025 20:08
@RoyEJohnson RoyEJohnson marked this pull request as draft December 1, 2025 20:08
@RoyEJohnson RoyEJohnson force-pushed the core-1389-toc-button-accessibility-issues branch from 26a927b to daac86a Compare December 1, 2025 22:02
@RoyEJohnson RoyEJohnson marked this pull request as ready for review December 1, 2025 22:15
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a directory and split this file into pieces

> svg {
${toolbarIconStyles};
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no more hidden version of this in desktop. I also refactored two mobile functions into one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything here is moved here unchanged.



// tslint:disable-next-line: variable-name
export const TOCControlButton = tocConnector(({open, close, isOpen, ...props}: MiddleProps) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new button that replaces two buttons. Added aria-controls

OpenStaxClaude and others added 3 commits December 2, 2025 12:00
Creates a unified TOCControlButton component that maintains focus when
toggling the table of contents state. This fixes the accessibility issue
where focus was lost when the button state changed.

Changes:
- Added TOCControlButton component with aria-expanded and aria-controls
- Replaced OpenTOCControl and CloseTOCControl with single TOCControlButton
- Button now uses simplified "Table of Contents" label
- Button maintains focus across state changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@RoyEJohnson RoyEJohnson force-pushed the core-1389-toc-button-accessibility-issues branch from 842b475 to e2977d6 Compare December 2, 2025 18:00
Copy link
Member

@Dantemss Dantemss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on Heroku and the label is there and the button seems to keep focus, but there's one small issue where the ToC starts open, but the button starts on the closed state, maybe related to isOpen always being set to null? This is probably the only thing that I'd say really needs to be fixed.

The video in the slack thread also mentions a focus order issue that is not on the card, but it's possible that is just a "won't fix".

aria-controls='toc-sidebar'
aria-label={`Click to ${isOpen ? 'close' : 'open'} the Table of Contents`}
onClick={isOpen ? close : open}
isOpen={null}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason why this attribute gets null and not isOpen?

message={isOpen ? openSearchMessage : closedSearchMessage}
data-analytics-label={isOpen ? 'Click to close Search' : 'Click to open Search'}
onClick={(desktop && hasQuery) || isOpen ? close : open}
isOpen={desktop ? hasQuery || props.isOpen : props.isOpen}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you just copied this but this logic is pretty confusing, especially with isOpen vs props.isOpen

import type { InnerProps } from './types';
import styled, { css } from 'styled-components/macro';
import { toolbarIconColor } from '../constants';
import { toolbarDefaultButton, toolbarDefaultText } from '../Toolbar/styled';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be sorted I suppose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants